home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / bipl.zip / PROCS.ZIP / PROCNAME.ICN < prev    next >
Text File  |  1992-09-29  |  977b  |  34 lines

  1. ############################################################################
  2. #
  3. #    File:     procname.icn
  4. #
  5. #    Subject:  Procedure to produce name of procedure
  6. #
  7. #    Author:   Ralph E. Griswold
  8. #
  9. #    Date:     September 17, 1992
  10. #
  11. ###########################################################################
  12. #
  13. #  procname(p) produces the name of a procedure from a procedure value.
  14. #  Here, the term "procedure" includes functions, operators, and
  15. #  record constructors.  In the case of operators, the number of
  16. #  arguments is appended to the operator symbol.
  17. #
  18. #  It fails if p is not of type procedure.
  19. #
  20. ############################################################################
  21.  
  22. procedure procname(p)
  23.  
  24.    if type(p) ~== "procedure" then fail
  25.  
  26.    image(p) ? {
  27.       tab(upto(' ') + 1)        # we trust image() ...
  28.       tab(upto(' ') + 1)        # this for record constructors
  29.       return if upto(&letters) then tab(0) else tab(0) || args(p)
  30.       }
  31.  
  32. end
  33.  
  34.